﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;

using EdgeStatz.ESSystems.Objects;

namespace EdgeStatz.ModelEngine.ReportTools
{
    public class ReportEngine
    {
        ReportToolsXml xmlReader;

        public string ModelPath { get { return xmlReader.ModelPath; } }

        public string ModelName { get { return xmlReader.ModelName; } }

        public string[] ReportNames { get { return xmlReader.ReportNames; } }

        public string[] FileNames { get { return xmlReader.FileNames; } }

        public ES_R_ReportCollection Reports { get { return xmlReader.Reports; } }

        public ES_R_Report GetReport(int index)
        {
            if (index >= 0 && index < Reports.Count)
                return Reports[index];
            else
                return null;
        }

        public ES_R_Report GetReport(string report_name) 
        {
            for (int i = 0; i < Reports.Count;i++ )
                if(Reports[i].Name.ToUpper().Equals(report_name.ToUpper()))
                    return GetReport(i);
            return null;
        }

        public string GetReportName(int index) { return xmlReader.GetReportName(index); }

        public string GetFileName(int index) { return xmlReader.GetFileName(index); }

        public string GetFileName(string reportName) { return xmlReader.GetFileName(reportName); }

        public ReportEngine(string xml_path) { xmlReader = new ReportToolsXml(xml_path); }
    }
}
